using System;
using System.Drawing;

namespace WebChart
{
	public class LineChart : Chart
	{
		// Methods
		public LineChart()
		{
		}

		public LineChart(ChartPointCollection data) : base(data)
		{
		}

		public LineChart(ChartPointCollection data, Color color) : base(data, color)
		{
		}

		public override void Render(Graphics graphics, int width, int height)
		{
			ChartEngine engine = base.Engine;
			float scaleX = engine.scaleX;
			float scaleY = engine.scaleY;
			Pen pen = base.Line.GetPen(graphics);
			Point empty = Point.Empty;
			int num3 = 1;
			float num4 = scaleX / 2f;
			bool flag = (base.shadow != null) && base.Shadow.Visible;
			Pen pen2 = null;
			if (flag)
			{
				pen2 = new Pen(base.Shadow.Color);
			}
			Point point3 = Point.Empty;
			Point point4 = Point.Empty;
			foreach (ChartPoint point5 in base.Data)
			{
				int y = (int) (point5.yvalue * scaleY);
				int x = (int) ((num3 * scaleX) - num4);
				Point point2 = new Point(x, y);
				if (base.showLineMarkers)
				{
					base.lineMarker.Render(graphics, x, y);
				}
				if (flag)
				{
					point4 = new Point(point2.X + base.Shadow.OffsetX, point2.Y + base.Shadow.OffsetY);
				}
				if (num3 > 1)
				{
					if (flag)
					{
						graphics.DrawLine(pen2, point3, point4);
					}
					graphics.DrawLine(pen, empty, point2);
				}
				empty = point2;
				if (flag)
				{
					point3 = point4;
				}
				num3++;
			}
			if (flag)
			{
				pen2.Dispose();
			}
			pen.Dispose();
			if (base.dataLabels.visible)
			{
				base.RenderDataLabels(graphics);
			}
		}
	}
}
